package org.atlantis.grosbeak.depot;

import org.atlantis.grosbeak.depot.beans.Animal;
import org.atlantis.grosbeak.depot.env.Depoter;
import org.atlantis.grosbeak.depot.loader.MapLoader;
import org.atlantis.grosbeak.lang.Strings;

public class Utils {

	public static Depot I(String... ss) {
		String json = "{";
		json += Strings.join(ss, ",");
		json += "}";
		/*System.out.println(json);
		Map<String, Map<String, Object>> map = Jsons.fromJson(Map.class, json);
		for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
			System.out.println(entry.getKey());
			for (Entry<String, Object> e : entry.getValue().entrySet()) {
				System.out.println(" -" + e.getKey());
				System.out.println(" -" + e.getValue());
				System.out.println("---");
			}
			System.out.println("===");
		}*/
		return new Depoter(new MapLoader(json));
	}

	public static String J(String name, String s) {
		return name + " : {" + s + "}";
	}

	public static Animal A(String s) {
		Depot depot = I(J("animal", s));
		return depot.get(Animal.class, "animal");
	}
}
